From ad781ad85d98686ea0e00595cb60e617b23bb625 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Tue, 2 Jun 2026 16:16:49 -0400 Subject: [PATCH] windowManager: Expose WorkspaceTracker blockUpdates & unblockUpdates Update blocking is currently only used by the workspace switcher popup, but the workspace animation needs to do the same. To prepare for that, expose block workspace updates on WindowManager to make it available outside the module. Use a counter to track block/unblock calls and avoid contention over the _pauseWorkspaceCheck boolean inside WorkspaceTracker. Part-of: (cherry picked from commit 217b1502057a78b13a3a5dd73a8b202e81aec127) --- js/ui/windowManager.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 92d6cf8aa..fe824a1ed 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -512,6 +512,7 @@ export class WindowManager { this._isWorkspacePrepended = false; this._canScroll = true; // limiting scrolling speed + this._blockCount = 0; this._shellwm.connect('kill-window-effects', (shellwm, actor) => { this._minimizeWindowDone(shellwm, actor); @@ -1066,6 +1067,33 @@ export class WindowManager { this._workspaceTracker.keepWorkspaceAlive(workspace, duration); } + blockWorkspaceUpdates() { + if (++this._blockCount > 1) + return; + + if (!this._workspaceTracker) + return; + + this._workspaceTracker.blockUpdates(); + } + + unblockWorkspaceUpdates() { + console.assert(this._blockCount > 0, + 'Unmatched call to unblockWorkspaceUpdates()'); + if (this._blockCount === 0) + return; + + this._blockCount -= 1; + + if (this._blockCount !== 0) + return; + + if (!this._workspaceTracker) + return; + + this._workspaceTracker.unblockUpdates(); + } + skipNextEffect(actor) { this._skippedActors.add(actor); } @@ -1807,10 +1835,10 @@ export class WindowManager { if (!Main.overview.visible) { if (this._workspaceSwitcherPopup == null) { - this._workspaceTracker.blockUpdates(); + this.blockWorkspaceUpdates(); this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup(); this._workspaceSwitcherPopup.connect('destroy', () => { - this._workspaceTracker.unblockUpdates(); + this.unblockWorkspaceUpdates(); this._workspaceSwitcherPopup = null; this._isWorkspacePrepended = false; }); -- 2.39.5